Quantcast
Channel: SCN : Discussion List - Java Development
Viewing all 277 articles
Browse latest View live

Using JSTL with Netweaver 7.0

$
0
0

I got following error message when I used JSTL in NWDS 7.0

 

com.sap.engine.services.servlets_jsp.lib.jspparser.exceptions.JspParseException: Tag library descriptor cannot be found for uri:{1}].

 

I just imported JSTL core tag library into my JSP file and I have included jstl.jar and standard.jar(1.1.2 version) in external library.

Can anyone guide me on how to use JSTL with NWDS 7.0


JSF Authentication

$
0
0

Hello,

 

I'm trying to protect a JSP behind a login page on SAP NW 7.4. Nobody should be able to access the page unless they login beforehand (using the default NW Login).

 

Like stated here: Specifying Authentication for Java Applications - Integrating Security Functions - SAP Library. (and the pages in the same chapter)

 

I added these lines to the web.xml in the Web project:


<login-config>

  <auth-method>FORM</auth-method>

</login-config>

 

And these in web-j2ee-engine.xml:

 

<login-module-configuration>

  <login-module-stack>

  <login-module>

  <login-module-name>BasicPasswordLoginModule</login-module-name>

  <flag>SUFFICIENT</flag>

  </login-module>

  </login-module-stack>

</login-module-configuration>


However, when I deploy the project I can still access the page without providing my credentials first.

 

Can you help me find whats missing?

 

Thanks and best Regards

Fabio Zuber

Can't load IA 64-bit .dll on a AMD 64-bit platform error with JCO 3 64 bit

$
0
0

I am facing following error in

 

java.lang.ExceptionInInitializerError: Error getting the version of the native layer: java.lang.UnsatisfiedLinkError: C:\Windows\System32\sapjco3.dll: Can't load IA 64-bit .dll on a AMD 64-bit platform

 

My environment is as below

 

Java : jdk1.6.0_45 64 bit

OS: Windows 8.1 Pro

CPU: Intel core i3 , 64 -bit operating system.

 

Kindly help me.

Beginning in SAP with JAVA

$
0
0

Hi All,

 

Like to do some programming in SAP with JAVA.

What would be the best way to go about it?

I now work in Servlets and JSP.

Prefer to continue with the same.

Meantime connecting to SAP and reading its tables have become a necessity.

Also planning to develop some data entry forms in Servlets.

The Purchase requisition and Reservation screens in SAP are very good indeed,

Still our users demand more functionality than it presently offers.

Can such forms be developed in Java and data posted to SAP through its validations?

 

Thanks

Adding Function Imports to OData Services

$
0
0

Hello,

 

I try to add a Function Import in my OData service but it doesn't appear in the &metadata, so I can't access it.

I am following this tutorial : https://olingo.apache.org/doc/odata2/tutorials/jpafunctionimport.html

 

So, I have created a class wich contains the logic part :

 

public class MobileAppService {  @EdmFunctionImport(name = "GetApiValidity",            returnType = @ReturnType(type = Type.SIMPLE, isCollection = false),            httpMethod = HttpMethod.GET)  public int getApiValidity( ) {       return 123;  }
}

Another class to register the annotated Java methods :

 

public class LucEdmExtension implements JPAEdmExtension {  @Override  public void extendWithOperation(JPAEdmSchemaView view) {       view.registerOperations(MobileAppService.class, null);  }
}

Finally I have registered this last class in the ODataJPAContext :

 

@Override  public ODataJPAContext initializeODataJPAContext()                 throws ODataJPARuntimeException {       ODataJPAContext oDataJPAContext = this.getODataJPAContext();       try {            EntityManagerFactory emf = Utility.getEntityManagerFactory();            oDataJPAContext.setEntityManagerFactory(emf);            oDataJPAContext.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);            oDataJPAContext.setJPAEdmExtension(new LucEdmExtension());            return oDataJPAContext;       } catch (Exception e) {            throw new RuntimeException(e);       }  }

As far as I know, it should be enough to get this kind of metadata :

 

<EntityContainer Name="ODataEntityContainer" m:IsDefaultEntityContainer="true">    . . .     <FunctionImport Name="GetApiValidity" ReturnType=""Edm.Int32"" m:HttpMethod="GET"></FunctionImport>     . . .</EntityContainer>

But I have nothing related with Function Import... Could you please help me ?

I am using a class of type EdmProvider to configure all other services, should I add something in this class for the Function Import ?

 

I am using OData 2.0 version.

 

Thanks a lot,

 

François

Access Extractor Framework from Java application

$
0
0

Hello everyone,

 

I am just searching for an option to access SAP Extractors which can be defined in the Extractor Framework via a Java application.

 

I read the following articles:

EFWK_SETUP - Technical Operations - SCN Wiki

 

https://help.sap.com/saphelp_nw70ehp1/helpdata/de/28/4c553c42360a40e10000000a114084/content.htm?frameset=/de/28/4c553c42360a40e10000000a114084/frameset.htm&current_toc=/de/e3/e60138fede083de10000009b38f8cf/plain.htm&node_id=249&show_children=true#jump249

 

https://wiki.scn.sap.com/wiki/display/EIM/Extractors+with+DataServices+-+Monitoring

 

I understand, that it is possible to provide data via RFC which are collected by an extractor.

 

But how can I access those data from a java application.

Is there a RFC function module or a bapi which I can call via JCo?

 

 

Best Regards

Markus

Table Filter in Webdynpro java throws Null Pointer Exception

$
0
0

My development environment is NW 7.01

I am using TableFilter class for the Table.

All my Table columns are GroupedColumns.

I have couple columns using LinkToAction UI element in the table.

Filter was working fine until I bind the LinkToAction visiblility property to context variable.

Now when I use filter I get Null Pointer Exception on 156 line.

Not sure what the issue is.

I am attaching the TableFilter Java class that I am using.

Any help is appreciated.

 

Thanks

Anu

Webchannel XHTML page issues with different browsers .

$
0
0

Hi Experts,

 

Need your help with the issues that we are facing in IE and Chrome. ( i am very much new to JAVA development / anything related to web pages ) .

 

Indentation : I have a output link in the page which needs to be formatted( need to add a single space before displaying the link ).I am using WEC tag for output html that has predefined styleclass and cannot be changed.  So I added an output text with a style class  with left padding property  and value as '' . This is working in IE but not in chrome .

 

Any pointers regarding this behavior ?

 

Thanks in Advance .

 

Veena .


Java access to SLD's DBs gives error

$
0
0

I want to retrieve the list of HANAs registered in SLD, but got into an error. What I have done incorrectly?

Wonder is there API docs, sample codes somewhere for the Java WBEM client?

 

-----------------------------------------------------------------------------------------------------------------------------------

import com.sap.lcr.api.cimclient.CIMClient;

import com.sap.lcr.api.cimclient.CIMOMClient;

import com.sap.lcr.api.cimclient.ClientFactory;

import com.sap.lcr.api.cimclient.HttpRequestSender;

import com.sap.lcr.api.sapmodel.*;

 

URL url = new URL("http://SERVER:PORT/sld/cimom");

HttpRequestSender requestSender = new HttpRequestSender(url, 'user', 'password');

CIMOMClient cimomClient = new CIMOMClient(requestSender);

CIMClient cimClient = new CIMClient(cimomClient);

 

// Retrieve list of Message Servers

SAP_BCMessageServerAccessor msgAccessor = new SAP_BCMessageServerAccessor(cimClient);

SAP_BCMessageServer[] msgServers = msgAccessor.enumerateSAP_BCMessageServerInstances();                  // Works

 

// Retrieve list of Application Servers

SAP_BCApplicationServerAccessor appAccessor = new SAP_BCApplicationServerAccessor(cimClient);

SAP_BCApplicationServer[] appServers = appAccessor.enumerateSAP_BCApplicationServerInstances();              // Works

 

// Retrieve list of DBs

SAP_DatabaseSystemAccessor dbAccessor = new SAP_DatabaseSystemAccessor(cimClient);

SAP_DatabaseSystem[] dbSys = dbAccessor.enumerateSAP_DatabaseSystemInstances();          // Error - ErrorCIM_ERR_FAILED: Failed to create a JavaCIMObject from a CIMInstance for target class: SAP_HDBSystem

SAP NetWeaver Developer Studio - change default workspace

$
0
0

Hello!

 

How can I change the default workspace?

 

When I start the SAP NetWeaver Developer Studio there is no prompt to change the workspace dir. But in Preferences->General->Startup and Shutdown <i>Prompt for workspace on startup</i> is set.

SAP NetWeaver Developer Studio automatically load this workspace dir: @user.home/workspace (sit in config.ini)

Then I have to <i>Switch workspace</i> and restart SAP NetWeaver Developer Studio.

 

How is it possible to show the <i>Prompt for workspace on startup</i>?

 

Regards,

Armin

JSP compilation error while setting up JCo in NWA

$
0
0

Hello Folks,

 

I get the following JSP compilation error when I try to start JCo in XCM to set up connection to ECC system. I am not sure what this is. Any help is appreciated. Attached is the log of the error downloaded from the netweaver logs.

 

Error: Error in compiling [ipc.admin/xcm/HelpConfig.jsp] in application [sap.com/crm~ipc]

 

XCM error.JPG

How to retrieve SAP name for a given user( I- number) in Java

$
0
0

Hi All,

 

I am working on a Java OData Service in HCP.  For authetication and autherization I have used SAML2 and security configuration in deployment descriptor respectively. To read user info, we used the class  "com.sap.security.um.user.User" and "com.sap.security.um.service.UserManagementAccessor" from the neo-java-web api.

 

Now I have a requirement to retrieve SAP name for a given user name retrieved using neo-java-web-api. I have also heard of SAP Corporate LDAP read only service. Is anyone aware of this Corporate LDAP service and how to use it in Java or Is there anyother way to retrieve SAP name for a given user ?

 

 

Thanks for help,

 

Regards,

Santosh.

Java EE HTTP Client. A strange error

Required Development Component for build

$
0
0

Hi,

 

I'm trying to develop EJB Development Component and I'm using some code I found out on this site. Unfortunately I'd like to create a Dev Component and use SAP Component Model in development so I need to set-up dependencies for my component to SAP standard. Now is there some easy way how to find out in which Software and Development Component from SAP the required class/interface is defined?

(and I need to provide this DC as reference?)

 

For example: in which DC I could find:

com.sap.aii.af.service.cpa.LookupManager

com.sap.engine.interfaces.messaging.api.ConnectionFactory

com.sap.engine.interfaces.messaging.api.APIAccessFactory

com.sap.engine.interfaces.messaging.api.logger.MessageLogger

 

 

Best regards,

 

Milan

p4 over http tunneling

$
0
0

Hi guys

I have SAP NW 7.4 (only JAVA stack).

Was configure p4, add to profile this parameters

 

icm/server_port_2 = PROT=P4, PORT=5$(SAPSYSTEM)04

icm/server_port_3 = PROT=P4SEC, PORT=5$(SAPSYSTEM)05

 

and set ALLOW_NON_SSL_TUNNELING = true

 

can you help me, what I do wrong, I write next JAVA code but can't connect to server

 

import javax.naming.InitialContext;

import javax.naming.NamingException;

import java.util.Properties;

 

public class rmi2 {

 

   private static InitialContext ctx = null;

 

   public static void main(String[] args) {

   init ("", "10.0.0.5", "50005", "user", "1111", "httptunneling");

  }

 

   public static void init(String schema, String host, String port, String user, String pass, String transportType) {

   try {

  Properties p = new Properties();

   if (schema == null) {
    schema = "P4://";
   }
   p.put("java.naming.factory.initial", "com.sap.engine.services.jndi.InitialContextFactoryImpl");

  p.put("java.naming.provider.url", schema+host+":"+port);

  p.put("java.naming.security.principal", user);

  p.put("java.naming.security.credentials", pass);

   // Parameter transportType for Transport Layer Queue has value
  // "None", "ssl", "httptunneling_ssl" or "httptunneling".
   ctx = new InitialContext(p);

  System.out.println("NamingClient context: " + ctx);

  } catch(NamingException e) {

  e.printStackTrace();

  }

  }

}

 

get this error

 

com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception while trying to get InitialContext. [Root exception is com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.]

  at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:539)

  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)

  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)

  at javax.naming.InitialContext.init(InitialContext.java:244)

  at javax.naming.InitialContext.<init>(InitialContext.java:216)

  at rmi2.init(rmi2.java:25)

  at rmi2.main(rmi2.java:10)

  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

  at java.lang.reflect.Method.invoke(Method.java:497)

  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Caused by: com.sap.engine.services.security.exceptions.BaseLoginException: Cannot create new RemoteLoginContext instance.

  at com.sap.engine.services.security.remote.login.RemoteLoginContext.<init>(RemoteLoginContext.java:98)

  at com.sap.engine.services.jndi.implclient.LoginHelper.clientSideLogin(LoginHelper.java:78)

  at com.sap.engine.services.jndi.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:403)

  ... 11 more


How to connect to My HDB Server using JDBC

$
0
0

Hi Experts,

 

I am trying to connect to my SAP HANA DB Server with following code.

 

package connection;

import java.sql.*;

public class ServerCon {

   public static void main(String[] argv) {

      Connection connection = null;

      try {         

          try{

              Class.forName("com.sap.db.jdbc.Driver");

          }catch (Exception e) {

              e.printStackTrace();

          }

        

         connection = DriverManager.getConnection(

            "jdbc:sap://xx.xxx.xxx.xxx:30015/","SAP PID as user name","SAP DB Password");   

 

      } catch (SQLException e) {

          e.printStackTrace();

         System.err.println("Connection Failed. User/Passwd Error?");

         return;

      }

 

      if (connection != null) {

         try {

            System.out.println("Connection to HANA successful!");

            Statement stmt = connection.createStatement();

            ResultSet resultSet = stmt.executeQuery("Select 'hello world' from dummy");

            resultSet.next();

            String hello = resultSet.getString(1);

            System.out.println(hello);

       } catch (SQLException e) {

          System.err.println("Query failed!");

       }

     }

   }

}

 

 

 

Using the above code i am getting the following exception:

 

 

com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Cannot connect to jdbc:sap://xx.xxx.xxx.xxx:30015/ [Cannot connect to host xx.xxx.xxx.xxx:30015 [Connection refused: connect], -813.].

    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:230)

    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.createException(SQLExceptionSapDB.java:214)

    at com.sap.db.jdbc.exceptions.SQLExceptionSapDB.generateDatabaseException(SQLExceptionSapDB.java:197)

    at com.sap.db.jdbc.Driver.connect(Driver.java:192)

    at java.sql.DriverManager.getConnection(Unknown Source)

    at java.sql.DriverManager.getConnection(Unknown Source)

    at connection.ServerCon.main(ServerCon.java:14)

 

 

 

Could you please let me know what could be the issue here? i dont know i am giving correct host name and port also. I have taken host name from my eclipse as follows:

 

 

Thank you very much in advance..

EJB Error: Unable to look up a remote EJB

$
0
0

I am getting the following error when I am trying to look up a remote EJB from another EJB.

 

Error occurs while the EJB Scheme Context Factory trying to resolve an EJB with scheme ejb:/appName=qp.org/testremotecidear, jarName=qp.org~testcidremoteejb.jar, beanName=TestCIDRemoteEJb, interfaceType=remote, interfaceName=com.qp.cid.ejb.TestCIDRemoteEJbRemote. Check server's trace files for more details.

[EXCEPTION]

javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: EJB Reference

Type: schemeLookup

Content: true

Type: interfaceType

Content: remote

Type: remote

Content: com.qp.cid.ejb.TestCIDRemoteEJbRemote

Type: ejb-link

Content: TestCIDRemoteEJb

Type: appName

Content: qp.org/testremotecidear

Type: clientAppName

Content: qp.org/testremotecidear

Type: ejb-jar

Content: qp.org~testcidremoteejb.jar

 

java.lang.ClassCastException: cannot assign instance of com.sap.engine.services.rmi_p4.P4ProxyWrapper to field com.sap.engine.services.ejb3.runtime.SerializedClientProxy.interfaces of type [Ljava.lang.Class; in instance of com.sap.engine.services.ejb3.runtime.SerializedClientProxy

at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2054)

at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1227)

at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1999)

at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1917)

at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1793)

at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1338)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:358)

at com.sap.engine.services.rmi_p4.reflect.P4InvocationHandler.readResult(P4InvocationHandler.java:302)

at com.sap.engine.services.rmi_p4.reflect.P4InvocationHandler.invokeInternal(P4InvocationHandler.java:138)

at com.sap.engine.services.rmi_p4.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:52)

at com.sun.proxy.$Proxy906.resolveReference(Unknown Source)

at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:197)

at com.sap.engine.services.ejb3.runtime.impl.EJBObjectFactory.getObjectInstance(EJBObjectFactory.java:109)

at com.sap.engine.services.ejb3.runtime.impl.JNDIejbResolverContext.lookup(JNDIejbResolverContext.java:122)

at javax.naming.InitialContext.lookup(InitialContext.java:392)

at javax.naming.InitialContext.lookup(InitialContext.java:392)

 

 

Can you please let me know what could be the problem.

 

 

The code for the EJB method that invokes this remote EJB is as follows:

 

 

    public String callCIDRemoteBean(String tempMessage){

 

    String retMessage = "PID EJB Message:"+tempMessage;

    String cidejbMessage = "";

 

    String providerUrl = "<hostname>:<port>";

    String securityPrincipal = "<user>";

    String securityCredentials = "<password>";

 

    Properties props = new Properties();

 

    try{      

 

 

    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

 

 

    props.put(Context.PROVIDER_URL, providerUrl);

   

    props.put(Context.SECURITY_PRINCIPAL, securityPrincipal);

 

 

    props.put(Context.SECURITY_CREDENTIALS, securityCredentials);

    // props.put("force_remote", "true");

    props.put(Context.URL_PKG_PREFIXES, "com.sap.engine.services");  

 

 

    InitialContext ctx = new InitialContext(props);

    System.err.println("After the InitialContext");

    Object obj = ctx.lookup("ejb:/appName=qp.org/testremotecidear, jarName=qp.org~testcidremoteejb.jar, beanName=TestCIDRemoteEJb, interfaceType=remote, interfaceName=com.qp.cid.ejb.TestCIDRemoteEJbRemote");

    System.err.println("Class name-"+ obj.getClass().getName());

   

    System.err.println("After calling remote EJB: cidejbMessage"+cidejbMessage);

    }catch (Exception e) {

    System.err.println("Inside Exception");    

    e.printStackTrace();

    }

    return retMessage + ": "+cidejbMessage;

    }

SAP JCO 3, DestinationDataProvider, Environment and tomcat

$
0
0

Hi all,

 

So I am upgrading from SAP JCO 2 to 3 and have implemented my own DestinationDataProvider. I register it with Environment.registerDestinationDataProvider. This is in a tomcat environment with many WARs, many of which connect to SAP using JCO and hold their own connection details. I've started getting IllegalStateException:

DestinationDataProvider already registered [com.hre.sapjco.rfc.SapJcoDestinationDataProvider]

 

and then came across this:

JCO 3.0.6 on Tomcat server with multiple apps connecting to SAP

 

The question is that I find has not been answered adequately is how do I do this in an environment with many wars.

 

Environment has no way of returning the registered DestinationDataProvider in order to add new connection details. I cannot just ignore the error because then the registered DestinationDataProvider will not have my connection properties.

 

Is it even correct that Environment is shared across the whole tomcat or am I experiencing a different problem? How is it doing this? Is there any way around this?

 

Regards,

Melion

ABAP function module in Java servlets

$
0
0

Hi friends,

 

could any one please let me know how to call ABAP function module in Java servlets

 

Thanks

Srini

SAP CE Portal connection to JBOSS-JMS queue

$
0
0

HI,

 

We have a requirement for connecting to JBOSS server - JMS queue to drop JMS message from CE portal using JAVA code. Can some one please explain the process how to connect to JBOSS ? We are using NWDS  to develop our code and code will be deployed on CE engine. During runtime when this code executes from CE portal , it has to connect to JBOSS-JMS queue to drop the JMS message to JMS queue. Thanks.

Viewing all 277 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>