Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Getting error - cannot find symbol for import and @

ora_1978Mar 19 2014 — edited Mar 21 2014

I am getting error like cannot find symbol for import and @ . How to resolve it ?

  1  create or replace and compile java source named "AddressTypeDbProcedure" as
  2  import javax.xml.bind.annotation.XmlAccessType;
  3  import javax.xml.bind.annotation.XmlAccessorType;
  4  import javax.xml.bind.annotation.XmlElement;
  5  import javax.xml.bind.annotation.XmlSeeAlso;
  6  import javax.xml.bind.annotation.XmlType;
  7  public class AddressType {
  8      @XmlElement(name = "StreetAddress")
  9      protected String streetAddress;
10      public String getStreetAddress() {
11          return streetAddress;
12      }
13      public void setStreetAddress(String value) {
14          this.streetAddress = value;
15      }
16* };
17  /

Warning: Java created with compilation errors.

SQL> show errors;
Errors for JAVA SOURCE "AddressTypeDbProcedure":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      AddressTypeDbProcedure:1: cannot find symbol
0/0      6 errors
0/0      location: package javax.xml.bind.annotation
0/0      import javax.xml.bind.annotation.XmlAccessType;
0/0      ^
0/0      AddressTypeDbProcedure:2: cannot find symbol
0/0      symbol  : class XmlAccessorType
0/0      location: package javax.xml.bind.annotation
0/0      import javax.xml.bind.annotation.XmlAccessorType;
0/0      ^
0/0      AddressTypeDbProcedure:3: cannot find symbol

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      symbol  : class XmlElement
0/0      location: package javax.xml.bind.annotation
0/0      import javax.xml.bind.annotation.XmlElement;
0/0      ^
0/0      AddressTypeDbProcedure:4: cannot find symbol
0/0      symbol  : class XmlSeeAlso
0/0      location: package javax.xml.bind.annotation
0/0      import javax.xml.bind.annotation.XmlSeeAlso;
0/0      ^
0/0      AddressTypeDbProcedure:5: cannot find symbol
0/0      symbol  : class XmlType

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      location: package javax.xml.bind.annotation
0/0      import javax.xml.bind.annotation.XmlType;
0/0      ^
0/0      AddressTypeDbProcedure:7: cannot find symbol
0/0      symbol  : class XmlElement
0/0      location: class AddressType
0/0      @XmlElement(name = "StreetAddress")
0/0      ^
0/0      symbol  : class XmlAccessType
SQL>

Vinodh

Comments

Brian Jeffries-Oracle
Hi Laurent,

To create the unit test repository, the repository user needs:
CONNECT, RESOURCE, CREATE VIEW

The "SYS" user can be any user that can connect as SYSDBA
this is used to execute the following:

grant select on dba_roles to repository_user;
grant select on dba_role_privs to repository_user;

create role UT_REPO_ADMINISTRATOR;
create role UT_REPO_USER;
grant create public synonym,drop public synonym to UT_REPO_ADMINISTRATOR;
grant select on dba_role_privs to UT_REPO_USER;
grant select on dba_role_privs to UT_REPO_ADMINISTRATOR;
grant select on dba_roles to UT_REPO_ADMINISTRATOR;
grant select on dba_roles to UT_REPO_USER;
grant select on dba_tab_privs to UT_REPO_USER; --3.1
grant select on dba_tab_privs to UT_REPO_ADMINISTATOR; --3.1
grant execute on dbms_lock to UT_REPO_USER; --3.1
grant execute on dbms_lock to UT_REPO_ADMINISTATOR; --3.1
grant ut_repo_user to UT_REPO_ADMINISTRATOR with admin option;
grant UT_REPO_ADMINISTRATOR to repository_user with admin option;

Alternatively, your dba could do the previous block (create role ... grant UT_REPO_ADMIN...) for repository_user and then you could create one without being prompted for the "SYS" connection.

Brian
SQL Developer Team.

Edited by: bjeffrie on Mar 1, 2012 11:55 AM to update with new privilege requirements
Laurent Schneider
Hi Brian,
I will ask my dba to create the user above.

I will update this thread later if needed

Thank you for your prompt answer,
Laurent
Laurent Schneider
but create public synonym is quite a powerful privilege to give... Can you tell me why is this needed and which synonyms will be created?
Brian Jeffries-Oracle
General answer is that create public synonym is only used in the case of setting a repository as shared. Doing so creates public synonyms for the unit test tables, views, and copy procedure.

Going through final code to see (& test) what the minimum requirements are for using individual/private repositories and will get back to you.

Brian Jeffries
SQL Developer Team
Brian Jeffries-Oracle
Answer
Hi Laurent,

Here is the minimum required to get past the internal checks and be able to use unit testing.

Once your DBA does this:

-- RUN ONCE TO SET UP REQUIRED UT ROLES WITH MINIMUM PRIVILEGES:

-- DROP ROLE UT_REPO_USER ;
-- DROP ROLE UT_REPO_ADMINISTRATOR ;
-- DROP USER MIN_PRIV_UT_REPO WITH CASCADE;

CREATE ROLE UT_REPO_USER ;
GRANT SELECT ON DBA_TAB_PRIVS TO UT_REPO_USER ; -- 3.1
GRANT EXECUTE ON DBMS_LOCK TO UT_REPO_USER ; -- 3.1
CREATE ROLE UT_REPO_ADMINISTRATOR ;
GRANT UT_REPO_USER TO UT_REPO_ADMINISTRATOR ; --3.1

-- EDIT/RUN FOR EACH USER/UNIT TEST REPOSITORY DESIRED:
-- Note: Replace MIN_PRIV_UT_REPO, USERS, TEMP as desired for your situation

CREATE USER MIN_PRIV_UT_REPO IDENTIFIED BY MIN_PRIV_UT_REPO
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP;

GRANT RESOURCE TO MIN_PRIV_UT_REPO ;
GRANT CONNECT TO MIN_PRIV_UT_REPO ;
GRANT CREATE VIEW TO MIN_PRIV_UT_REPO ;
GRANT SELECT ON DBA_ROLES TO MIN_PRIV_UT_REPO ;
GRANT SELECT ON DBA_ROLE_PRIVS TO MIN_PRIV_UT_REPO ;
GRANT UT_REPO_ADMINISTRATOR TO MIN_PRIV_UT_REPO ;


Then in to SQLDeveloper, select Tools->Unit Test->Select Current Repository, create/select a connection for MIN_PRIV_UT_REPO, and press "Yes" when asked if you want to create one.

Note that with the UT roles set up 'empty' like this, the menu options for managing a shared repository will be active and appear to work, but won't really do anything

Brian Jeffries
SQL Developer Team

Edited by: bjeffrie on Dec 22, 2009 3:08 PM

Edited by: bjeffrie on Dec 22, 2009 4:01 PM

Edited by: bjeffrie on Mar 1, 2012 11:43 AM to update with new privilege requirements for 3.1
Marked as Answer by Laurent Schneider · Sep 27 2020
Laurent Schneider
2 weeks later, I go the permission! I suppose you could optimize this process by removing the need of a role for dedicated repository. Or maybe create the role as a default role in Oracle 12...
1 - 6
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 18 2014
Added on Mar 19 2014
4 comments
3,076 views